package com.yzxb.messystem.entity;

import java.time.LocalDateTime;

/**
 * 生产记录实体类
 */
public class ProductionRecord {
    private Long id;
    
    // 工单ID，用于关联工单
    private Long workOrderId;
    
    // 工单对象，用于业务层关联查询
    private WorkOrder workOrder;
    
    private Integer quantity;
    
    private RecordType recordType;
    
    private String workstation;
    
    private String operator;
    
    private String shift;
    
    private String qualityStatus;
    
    private String remarks;
    
    private LocalDateTime createTime;
    
    private LocalDateTime updateTime;
    
    // 记录类型枚举
    public enum RecordType {
        PRODUCTION, // 生产
        REJECTION, // 不合格
        REWORK // 返工
    }
    
    // 这些方法可以在服务层中处理，或者通过MyBatis-Plus的插件来实现
    public void setCreateTimeDefault() {
        createTime = LocalDateTime.now();
        updateTime = LocalDateTime.now();
        if (recordType == null) {
            recordType = RecordType.PRODUCTION;
        }
    }
    
    public void setUpdateTimeDefault() {
        updateTime = LocalDateTime.now();
    }
    
    // Getters and Setters
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public Long getWorkOrderId() {
        return workOrderId;
    }
    
    public void setWorkOrderId(Long workOrderId) {
        this.workOrderId = workOrderId;
    }
    
    public WorkOrder getWorkOrder() {
        return workOrder;
    }
    
    public void setWorkOrder(WorkOrder workOrder) {
        this.workOrder = workOrder;
    }
    
    public Integer getQuantity() {
        return quantity;
    }
    
    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }
    
    public RecordType getRecordType() {
        return recordType;
    }
    
    public void setRecordType(RecordType recordType) {
        this.recordType = recordType;
    }
    
    public String getWorkstation() {
        return workstation;
    }
    
    public void setWorkstation(String workstation) {
        this.workstation = workstation;
    }
    
    public String getOperator() {
        return operator;
    }
    
    public void setOperator(String operator) {
        this.operator = operator;
    }
    
    public String getShift() {
        return shift;
    }
    
    public void setShift(String shift) {
        this.shift = shift;
    }
    
    public String getQualityStatus() {
        return qualityStatus;
    }
    
    public void setQualityStatus(String qualityStatus) {
        this.qualityStatus = qualityStatus;
    }
    
    public String getRemarks() {
        return remarks;
    }
    
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
    
    public LocalDateTime getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
    
    public LocalDateTime getUpdateTime() {
        return updateTime;
    }
    
    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }
}